﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.IO;
using System.Drawing.Drawing2D;
using 学院学生管理系统;

namespace WindowsFormsApplication1
{
    public partial class 出入登记查询 : Form
    {
        public 出入登记查询()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string t;
            OleDbConnection a4 = new OleDbConnection();
            OleDbCommand a5 = new OleDbCommand();
            a4.ConnectionString = Class1.mas;
            a4.Open();
            if (textBox1.Text == "")
            {
                MessageBox.Show("请输入查询日期！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                t = "select * from 出入登记 where 日期='" + textBox1.Text.Trim() + "'";
                a5.CommandText = t;
                a5.Connection = a4;
                OleDbDataReader a6 = a5.ExecuteReader();
                if (a6.Read() == false)
                {
                    MessageBox.Show("信息不存在！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    textBox1.Text = a6[0].ToString();
                    textBox2.Text = a6[1].ToString();
                    textBox3.Text = a6[2].ToString();
                    textBox4.Text = a6[3].ToString();
                    textBox5.Text = a6[4].ToString();

                    MessageBox.Show("查询成功！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
    }
}

    
